package cn.udrm.water.base.v1.waterdelivery.repository;

import javax.validation.constraints.NotNull;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import cn.udrm.water.base.v1.waterdelivery.entities.CanalSystemSubSection;

@Repository
public interface CanalSystemSubSectionRepository extends JpaRepository<CanalSystemSubSection, String>
		, JpaSpecificationExecutor<CanalSystemSubSection>{

	@EntityGraph(value="CanalSystemSubSection.all", type=EntityGraphType.FETCH)
	public Page<CanalSystemSubSection> findAll(@NotNull Specification<CanalSystemSubSection> specification, Pageable pageable);
	
	@Query(value="FROM CanalSystemSubSection w WHERE w.id=?1")
	@EntityGraph(value="CanalSystemSubSection.all", type=EntityGraphType.FETCH)
	public CanalSystemSubSection findAllById(String id);
}
